package com.zbkj.admin.task.weather;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.zbkj.common.model.merchant.Merchant;
import com.zbkj.common.model.monitor.ZfbMonitorEquipment;
import com.zbkj.service.service.MerchantService;
import com.zbkj.service.service.WeatherService;
import com.zbkj.service.service.monitor.IZfbMonitorEquipmentService;
import com.zbkj.service.service.monitor.ZfbMonitorDeviceStatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 天气定时任务
 * +----------------------------------------------------------------------
 * | 功能描述：定时检查监控设备状态，根据过期情况自动开启或关闭监控
 * +----------------------------------------------------------------------
 * @author xiaolic
 * +----------------------------------------------------------------------
 * @date 2025-05-07
 */
@Slf4j
@Component("WeatherTask")
public class WeatherTask {

    @Autowired
    private WeatherService weatherService;

    /**
     *
     */
    public void processAllMonitorDevices() {
        log.info("开始执行拉取天气数据定时任务...");
        try {
            // 崇仁，101240404
            // 叙州，101271103
            // 邻水，101270804
            List<String> list = Arrays.asList("101240404");
//            List<String> list = Arrays.asList("101240404", "101271103", "101270804");
            weatherService.pullWeather(list);
            log.info("拉取天气定时任务完成");
        } catch (Exception e) {
            log.error("拉取天气定时任务完成执行异常", e);
        }
    }
}
